package org.zfes.snowier.common.monitor.router.ws;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.socket.TextMessage;
import org.zfes.snowier.common.monitor.config.ws.MonitorWebSocketHandler;
import org.zfes.snowier.common.monitor.config.ws.dto.BarChartDto;
import org.zfes.snowier.common.monitor.config.ws.dto.JSONMSG;
import org.zfes.snowier.common.monitor.config.ws.dto.PieChartDto;
import org.zfes.snowier.common.monitor.config.ws.dto.TransAmont;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@Controller 
public class MockDataController {
	
	@Resource 
	MonitorWebSocketHandler myWebSocketHandler; 

 

    @RequestMapping(value="/mock/loadPie",method=RequestMethod.POST,produces =MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody Object loadPayKeshiRate(HttpServletRequest request) {
    	Map<String,List<PieChartDto>> data=Maps.newConcurrentMap();
    	
    	data.put("dataday", Lists.newArrayList(new PieChartDto("耳鼻喉科d",61.41D),new PieChartDto("儿科d",11.84D),new PieChartDto("妇产科d",10.85D)));
    	data.put("datamonth", Lists.newArrayList(new PieChartDto("耳鼻喉科m",61.41D),new PieChartDto("儿科m",11.84D),new PieChartDto("妇产科m",10.85D)));
    	data.put("datayear", Lists.newArrayList(new PieChartDto("耳鼻喉科a",61.41D),new PieChartDto("儿科a",11.84D),new PieChartDto("妇产科a",10.85D)));
    	JSONMSG msg=new JSONMSG(200).put("pieChart",data);
        return msg;
    }
//    data=[{
//		name: '支付宝',
//		y: 22,
//		z: 25
//	}, {
//		name: '微信',
//		y: 53,
//		z: 88
//	}, {
//		name: '银联',
//		y: 22,
//		z: 50
//	}];
    @RequestMapping(value="/mock/loadPie2",method=RequestMethod.POST,produces =MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody Object loadPayChannelRate(HttpServletRequest request) {
    	Map<String,List<PieChartDto>> data=Maps.newConcurrentMap();
    	
    	data.put("dataday", Lists.newArrayList(new PieChartDto("支付宝d",22D,25D),new PieChartDto("微信d",53D,88D),new PieChartDto("银联d",22D,50D)));
    	data.put("datamonth", Lists.newArrayList(new PieChartDto("支付宝m",22D,25D),new PieChartDto("微信m",53D,88D),new PieChartDto("银联m",22D,50D)));
    	data.put("datayear", Lists.newArrayList(new PieChartDto("支付宝a",22D,25D),new PieChartDto("微信a",53D,88D),new PieChartDto("银联a",22D,50D)));
    	JSONMSG msg=new JSONMSG(200).put("pieChart",data);
        return msg;
    }
    
//	
//	series: [{
//		name: '微信',
//		data: [88.9, 58.8, 79.3, 41.4, 38.6, 59.0, 59.6, 65.2, 59.3, 87.5, 59.3, 51.2]
//	}, {
//		name: '支付宝',
//		data: [83.6, 78.8, 78.5, 63.4, 56.0, 84.5, 55.0, 58.3, 91.2, 83.5, 86.6, 92.3]
//	}, {
//		name: '银行卡',
//		data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2]
//	}, {
//		name: '现金',
//		data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1]
//	}]
    
    @RequestMapping(value="/mock/loadbar",method=RequestMethod.POST,produces =MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody Object loadTransRate(HttpServletRequest request) {
    	
    	List<BarChartDto> data=Lists.newArrayList(
    			new BarChartDto("微信", Lists.newArrayList(88.9, 58.8, 79.3, 41.4, 38.6, 59.0, 59.6, 65.2, 59.3, 87.5, 59.3, 51.2)),
    			new BarChartDto("微信", Lists.newArrayList(88.9, 58.8, 79.3, 41.4, 38.6, 59.0, 59.6, 65.2, 59.3, 87.5, 59.3, 51.2)),
    			new BarChartDto("微信", Lists.newArrayList(88.9, 58.8, 79.3, 41.4, 38.6, 59.0, 59.6, 65.2, 59.3, 87.5, 59.3, 51.2)),
    			new BarChartDto("微信", Lists.newArrayList(88.9, 58.8, 79.3, 41.4, 38.6, 59.0, 59.6, 65.2, 59.3, 87.5, 59.3, 51.2))
    			
    			);
    			
    	JSONMSG msg=new JSONMSG(200).put("barChart",data);
        return msg;
    }
    
    
    
}
